< previous page page_393 next page >

Page 393
ing one matrix multiplication per point can add up quickly. If the object contains only three points, you will save as many multiplications and additions as you gain. For more complicated objects that contain hundreds of data points, the savings can be quite large.
Even more important, many graphic operations require a complex series of transformations. One operation may require a translation, rotation, scaling, inverse rotation, and inverse scaling. Combining all these operations into one matrix can save a lot of time when the program applies it to every point in a complex scene.
To examine a concrete example of composing transformation matrices, look at Figure 12.14. Here the object on the left has been rotated 30 degrees and then translated three units in the X direction and two units in the Y direction to produce the object on the right. The transformation matrix representing the rotation is:
e10a6a0a59f035e870d90cca05b85fce.gif
 z0413-01.gif
The matrix representing the translation is:
e10a6a0a59f035e870d90cca05b85fce.gif
 z0413-02.gif
Multiplying these two matrices gives the combined transformation matrix:
e10a6a0a59f035e870d90cca05b85fce.gif
 z0413-03.gif
Instead of multiplying the object's six points by two separate matrices, you can multiply them by the single combined transformation matrix.
Note that the order in which you multiply transformation matrices is very important. Figure 12.15 shows the same object as Figure 12.14. In this case, the translation matrix was placed on the left side of the multiplication, and the rotation matrix was placed on
0393-01.gif
Figure 12.14
Rotation followed by translation.

 
< previous page page_393 next page >